package com.xbongbong.pay.pojo;

import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
import org.apache.http.Header;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * http请求后返回
 * @author 魏荣杰
 * @date 2021/1/13 16:48
 * @since
 * @version
 */
@Setter
@Getter
public class PayHttpResponse implements Serializable {
    private static final long serialVersionUID = -4243005151870832904L;

    /**
     * http 状态码
     */
    private int status;
    /**
     * http header
     */
    private Map<String, String> headers;
    /**
     * http body 返回
     */
    private JSONObject body;

    public void setHeaders(Header[] headers) {
        this.headers = new HashMap<>();
        for (Header header : headers) {
            this.headers.put(header.getName(), header.getValue());
        }
    }
}
